//
//  StatusCellBottomView.swift
//  sina
//
//  Created by DXapple on 15/11/17.
//  Copyright © 2015年 sqlite. All rights reserved.
//

import UIKit

class StatusCellBottomView: UIView {

   @objc private func retweetedBtnDidClcik() {
        let temp = TempViewController()
    
    reweetedBtn.NavController()?.pushViewController(temp, animated: true)
    
    }
    
  override  init(frame: CGRect) {
        super.init(frame: frame)
    setupUI()
    }

  required init?(coder aDecoder: NSCoder) {
      fatalError("init(coder:) has not been implemented")
  }
    
    
    
    private func setupUI() {
    
        addSubview(reweetedBtn)
        addSubview(composeBtn)
        addSubview(likeBtn)
//        composeBtn.backgroundColor = UIColor.redColor()
        
        let w: CGFloat = 0.5
        let scale = 0.4
        
        reweetedBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(snp_left)
            make.top.equalTo(snp_top)
            make.bottom.equalTo(snp_bottom)

        }
        let s1 = sepView()
        addSubview(s1)
        s1.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(snp_centerY)
            make.left.equalTo(reweetedBtn.snp_right)
            make.height.equalTo(reweetedBtn.snp_height).multipliedBy(scale)
            make.width.equalTo(w)
        }
        
        
        composeBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(reweetedBtn.snp_right)
            make.top.equalTo(snp_top)
            make.height.equalTo(snp_height)
            make.width.equalTo(reweetedBtn.snp_width)
            
            
            
        }
        let s2 = sepView()
        addSubview(s2)
        s2.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(composeBtn.snp_right)
            make.centerY.equalTo(snp_centerY)
            make.height.equalTo(s1.snp_height)
            make.width.equalTo(s1.snp_width)
            
        }
        
        
        
        likeBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(composeBtn.snp_right)
            make.top.equalTo(snp_top)
            make.right.equalTo(snp_right)
            make.height.equalTo(snp_height)
            make.width.equalTo(composeBtn.snp_width)

            
        }
        
        
        reweetedBtn.addTarget(self, action: "retweetedBtnDidClcik", forControlEvents: .TouchUpInside)
        
    }
    //中间的线
    private func sepView() -> UIView {
        let v =  UIView()
        v.backgroundColor = UIColor.darkGrayColor()
        return v
    
    }
    
    
    
    //MARK: 1. 懒加载所有子控件

    private lazy var reweetedBtn: UIButton = UIButton(title: "转发", backImage: nil, color:UIColor.darkGrayColor(), image: "timeline_icon_retweet", size: 10)
    private lazy var composeBtn: UIButton = UIButton(title: "评论", backImage: nil, color: UIColor.darkGrayColor(),image: "timeline_icon_comment",size: 10)
    private lazy var likeBtn: UIButton = UIButton(title: "赞", backImage: nil, color: UIColor.darkGrayColor(),image: "timeline_icon_unlike",size: 10)
    
    
}
